home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGASIC
/
ADVBAS42.LZH
/
MONKEY.BAS
< prev
next >
Wrap
BASIC Source File
|
1987-12-13
|
4KB
|
131 lines
defint a-z
def fnf$(x)=right$("0"+mid$(str$(x),2),2)
seekattr=23 ' seek read-only, normal, hidden, system, and directory files
cmd$=command$
if cmd$="" then goto BadMonkey
i=instr(cmd$," ")
if i then fil$=left$(cmd$,i-1): cmd$=mid$(cmd$,i+1) _
else fil$=cmd$: goto DoIt
i=instr(cmd$," ")
if i then parm1$=left$(cmd$,i-1): cmd$=mid$(cmd$,i+1) _
else parm1$=cmd$: goto DoIt
i=instr(cmd$," ")
if i then parm2$=left$(cmd$,i-1): parm3$=mid$(cmd$,i+1) _
else parm2$=cmd$
DoIt:
if parm1$="" then goto Display
if instr(parm1$,"/") then p$=parm1$: gosub ExtractDate _
else if instr(parm1$,":") then p$=parm1$: gosub ExtractTime _
else p$=parm1$: gosub ExtractAttr
if parm2$="" then goto Display
if instr(parm2$,"/") then p$=parm2$: gosub ExtractDate _
else if instr(parm2$,":") then p$=parm2$: gosub ExtractTime _
else p$=parm2$: gosub ExtractAttr
if parm3$="" then goto Display
if instr(parm3$,"/") then p$=parm3$: gosub ExtractDate _
else if instr(parm3$,":") then p$=parm3$: gosub ExtractTime _
else p$=parm3$: gosub ExtractAttr
Display:
fil$=fil$+chr$(0)
call FindFirstF(fil$,seekattr,ercd)
if ercd then call UpCase(fil$): print "No such file as ";fil$: end
while ercd=0
gosub DisplayFile
call FindNextF(ercd)
wend
end
BadMonkey:
print "Disk Monkey v1.2 Public Domain 12/13/87 by Thomas Hanlin III"
print
print "Allows you to monkey with file date, time, and attributes."
print
print "Format: MONKEY filename.ext [date] [time] [attributes]"
print "Filename may include wildcards. Date/time/attr may be in any order."
print "Attributes: N normal, H hidden, S system, D directory, R read-only, A archive."
end
ExtractTime:
i=instr(p$,":")
hour=val(p$)
p$=mid$(p$,i+1)
minute=val(p$)
i=instr(p$,":")
if i then second=val(mid$(p$,i+1))
stime=-1
return
ExtractDate:
i=instr(p$,"/")
month=val(p$)
p$=mid$(p$,i+1)
day=val(p$)
i=instr(p$,"/")
if i then year=val(mid$(p$,i+1)) else year=val(mid$(date$,7))
sdate=-1
return
ExtractAttr:
attr=0
call upcase(p$)
if instr(p$,"R") then attr=attr+1
if instr(p$,"H") then attr=attr+2
if instr(p$,"S") then attr=attr+4
if instr(p$,"D") then attr=attr+16
if instr(p$,"A") then attr=attr+32
sattr=-1
return
DisplayFile:
ky$=inkey$
if ky$=chr$(19) then while inkey$="": wend ' handle CTRL-S for pause
dname$=space$(12)
call GetNameF(dname$,dlen)
call GetTimeF(dhour,dmin,dsec)
call GetDateF(dmonth,dday,dyear)
call GetAttrF(dattr)
print dname$;" ";fnf$(dmonth);"/";fnf$(dday);"/";fnf$(dyear);" ";
print fnf$(dhour);":";fnf$(dmin);":";fnf$(dsec);" ";
pattr=dattr: gosub DisplayAttr
if not (sdate or stime or sattr) then return
dname$=left$(dname$,dlen)+chr$(0)
print " ------> ";
if sdate and not stime then hour=dhour: minute=dmin: second=dsec
if stime and not sdate then day=dday: month=dmonth: year=dyear
if sdate or stime then call setftd(dname$,month,day,year,hour,minute,second)
if sdate then print fnf$(month);"/";fnf$(day);"/";fnf$(year);" ";_
else print space$(11);
if stime then print fnf$(hour);":";fnf$(minute);":";fnf$(second);" ";_
else print space$(11);
if not sattr then print: print: return
if sattr then call SetFattr(dname$,attr)
pattr=attr: gosub DisplayAttr
print
return
DisplayAttr:
if pattr=0 then print "N";
if pattr and 1 then print "R";
if pattr and 2 then print "H";
if pattr and 4 then print "S";
if pattr and 16 then print "D";
if pattr and 32 then print "A";
print
return